﻿@model workflowMVC.Models.GradePostModel

@{
    ViewBag.Title = "Chấm điểm bài thi";
}

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
<table class="ui-widget-content ui-corner-all" style="margin:auto;padding:5px">  
        <tr>
            <td>
                @Html.LabelFor(model => model.ContestTitle)
            </td>
            <td>
                @Html.TextBoxFor(model => model.ContestTitle, new { @readonly = true })
            </td>
        </tr>
               
      
        <tr>
            <td>
                @Html.LabelFor(model => model.Name)
            </td>
            <td>
                @Html.TextBoxFor(model => model.Name, new { @readonly = true })
            </td>
        </tr>

        <tr>
            <td>
                @Html.LabelFor(model => model.NumCode)
            </td>
            <td>
                @Html.TextBoxFor(model => model.NumCode, new { @readonly = true })
            </td>
        </tr>

        <tr>
            <td>
                @Html.LabelFor(model => model.PostTittle)
            </td>
            <td>
                @Html.TextBoxFor(model => model.PostTittle, new { @readonly = true })
            </td>
        </tr>
        <tr>
            <td>
                @Html.LabelFor(model => model.CreateDate)
            </td>
            <td>
                @Html.TextBoxFor(model => model.CreateDate, new { @readonly = true })
            </td>
        </tr> 

        
        

        <tr>
            <td>
                @Html.LabelFor(model => model.TestContent)
            </td>
            <td>
                @Html.Raw(Model.TestContent)
            </td>
        </tr>

        <tr class="GradeZone">
            <td>
                @Html.LabelFor(model => model.grade)
            </td>
            <td>
                @Html.DropDownListFor(model => model.grade, ViewBag.gradez as SelectList, "---Chấm điểm---", new { @class = "disablewhengraded" })
            </td>
        </tr>

        <tr class="GradeZone">
            <td>
            </td>
            <td>
            @Html.HiddenFor(x => x.ContestId)
                <input type="submit" value="Gửi" />
                <p class = "visiwhengraded">Bạn đã chấm điểm bài này rồi</p>
            </td>
        </tr>

        @{
    if (Model.ContestStatusValue == 3)
    {
        <tr>
            <td>
                @Html.LabelFor(model => model.jG)
            </td>
            <td>
                <table style="border-width:1px;border-style:solid">
                    <thead>
                        <tr>
                            <th>
                                Giám khảo
                            </th>
                            <th>
                                Điểm
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @{
                            
        foreach (var i in Model.jG)
        {
        <tr>
            <td>@workflowMVC.Util.getName(i.Judge)</td>
            <td>@i.Grade</td>
        </tr>
        }
}
                    </tbody>
                </table>
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(model => model.TotalGrade)</td>
            <td>@Html.TextBoxFor(model => model.TotalGrade)</td>
        </tr>
    }
}
           
    </table>
}

@{
    if(Model.ContestStatusValue == 2 && Model.Judges.Contains(User.Identity.Name))
    {
        if (Model.IsGraded)
        {
            <script type="text/javascript">
                $(function(){
                    $('input[type="submit"]').hide();
                    $('.disablewhengraded').attr('disabled','true')
                    $('.visiwhengraded').show();
                });
                </script>

        
        }
        else
        {
            <script type="text/javascript">
             $(function(){
                    $('.visiwhengraded').hide();
                });
                </script>
        }
    }
    else
    {
        <script type="text/javascript">
            $(function () {
                $('.GradeZone').hide();
            });
                </script>
    }
}

